﻿<?php
defined('IN_DESTOON') or exit('Access Denied');
ob_start();
//获得标准
$ske = require DT_ROOT.'/file/cache/module-5.php';
$skes = explode('|',$ske['type']);


require_once 'Excel/reader.php';
// ExcelFile($filename, $encoding);
$data = new Spreadsheet_Excel_Reader(); 
// Set output Encoding. 
$data->setOutputEncoding('utf-8');

//连接数据库
@ $db=mysql_connect("localhost","root","[cosmos888]") or die("could not connect to database");
mysql_query("set names 'utf8'");//输出中文
mysql_select_db("destoon") or die (mysql_error());

 //die("ERROR");
//行业分类数据
$sqlsel="SELECT * FROM dt_category WHERE moduleid = '5'";
$ressel = mysql_query($sqlsel);
//会员信息数据
$sqlmb="SELECT * FROM dt_member";
$resmb = mysql_query($sqlmb);
$userid='2';

//查询供应产品的最大ID
$sqlmaxid='SELECT max(itemid) FROM dt_sell';
$maxitemid = mysql_query($sqlmaxid) or die("Error");
while ($r = mysql_fetch_array($maxitemid)) {
	$maxid = $r[0];
}

$datum_id=$_GET['datum_id'];
$tablename=$_GET['tablename'];
include tpl('header');
show_menu($menus);
?>     
<form ENCTYPE="multipart/form-data" ACTION="" METHOD="POST">
<div class="tt">导入数据</div>
<table cellpadding="2" cellspacing="1" class="tb">
    <tr class="on">
    
        <td colspan="2">&nbsp;<label for="f_1">XLS数据批量导入:</label></td>
    </tr>
    <tr>
        <td class="tl"><span class="f_red">*</span> 产品类型:</td>
        <td>
            <select name="catid" id="catid"  style="width:115px">
            <?php
             while ($r = mysql_fetch_array($ressel)) {
            ?>
            <option value="<?php echo $r['catid'];?>" <?php if($_POST['catid'] == $r['catid']) echo 'seleted';?>><?php echo $r['catname'];?></option>
            <?php
            }
            ?>
            </select>        </td>
    </tr>
    <tr>
        <td class="tl"><span class="f_red">*</span> 产品标准:</td>
        <td>
            <select name="typeid" id="typeid"  style="width:115px">
            <?php
            foreach($skes as $k=>$v){
            ?>
            <option value="<?php echo $k;?>"><?php echo $v;?></option>
            <?php
            }
            ?>
            </select>        </td>
    </tr>
    <tr>
        <td class="tl"> 产品地区:</td>
        <td>
            <input type="text" name="areaid" id="areaid" value="<?php echo $_POST['areaid']?>" />        </td>
    </tr>
    <tr>
        <td class="tl"> 产品介绍:</td>
        <td>
            <textarea name="introduce" id="introduce" cols="45" rows="5"><?php echo $_POST['introduce']?></textarea>        </td>
    </tr>
    <tr>
        <td class="tl"> 产品型号:</td>
        <td>
            <input type="text" name="model" id="model" value="<?php echo $_POST['model']?>" />        </td>
    </tr>
    <tr>
        <td class="tl"> 品牌:</td>
        <td>
            <input type="text" name="brand" id="brand" value="<?php echo $_POST['brand']?>" />        </td>
    </tr>
    <tr>
        <td class="tl"> 计量单位:</td>
        <td>
            <input type="text" name="unit" id="unit" value="<?php echo $_POST['unit']?>" />        </td>
    </tr>
    <tr>
        <td class="tl"> 最少起订量:</td>
        <td>
            <input type="text" name="minamount" id="minamount" value="<?php echo $_POST['minamount']?>" />        </td>
    </tr>
    <tr>
        <td class="tl"> 发货期限:</td>
        <td>
            <input type="text" name="days" id="days" value="<?php echo $_POST['days']?>" />天        </td>
    </tr>
    <tr>
        <td class="tl"> 备注:</td>
        <td>
            <textarea name="note" id="note" cols="45" rows="5"><?php echo $_POST['note']?></textarea>        </td>
    </tr>
    <tr>
        <td class="tl"> 导入XLS数据:</td>
        <td>
            <input NAME="MyFile" TYPE="file" value="">        </td>
    </tr>
    <tr>
        <td colspan="2">
            <input VALUE="提交" name="submit" id="submit" TYPE="submit">&nbsp;&nbsp;<input type="reset" name="reset" id="reset" value="重置" />
        </td>
    </tr>
</table>
</form>      

